import time
from pynput.keyboard import Controller, Key

keyboard = Controller()

time.sleep(3)  # 线程将暂停1秒
print('start.....')
keyboard.press(Key.enter)

for _ in range(40000):  # 使用下划线(_)表示我们不关心迭代变量的实际值
    # 执行你需要的操作
# 模拟按下一个普通字符键，比如'a'
    time.sleep(0.001)
    keyboard.press('e')
    time.sleep(0.001)
    keyboard.release('e')

# # 模拟按下并释放回车键
# keyboard.press(Key.enter)
# keyboard.release(Key.enter)
#
# # 或者使用更简洁的方式，直接输入一串字符
# keyboard.type('Hello, World!')